﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;   //   for Texture2D
using Microsoft.Xna.Framework;  //  for Vector2

namespace  ProjetPacman
{
    class Frame
    {
        public const float TILE_X = 20f;
        public const float TILE_Y = 20f; 

        private Texture2D _texture;    //  sprite texture 

        public Texture2D Texture
        {
            get { return _texture; }
            set { _texture = value; }
        }

        private Rectangle _rect;         

        public Rectangle Rect
        {
            get { return _rect; }
            set { _rect = value; }
        }

        private long _delay;

        public long Delay
        {
            get { return _delay; }
            set { _delay = value; }
        }

        public Frame(Texture2D texture, Rectangle rect)
        {
            this._texture = texture;
            this._rect = rect;
            this._delay = -1;
        }

        public Frame(Texture2D texture, Rectangle rect, long delay)
        {
            this._texture = texture;
            this._rect = rect;
            this._delay = delay;
        }

        public void Draw(SpriteBatch spriteBatch, Vector2 position)
        {
            spriteBatch.Draw(_texture, position, _rect, Color.White);
        }
    }
}


